//服务器全部接口返回的数据类型
export interface ResponseData {
    code: number,
    message: string,
    ok: boolean
}

//SPU数据的ts类型
export interface SpuData {
    category3Id: number | string,
    id?: number | string,
    spuName: string,
    tmId: number | string,
    description: string,
    spuImageList: null | SpuImg[],
    spuSaleAttrList: null | SaleAttr[]
}

//数组：其中的元素都是已有的SPU数据类型
export type Records = SpuData[]

//定义获取的已有的SPU接口返回的数据ts类型
export interface HasSpuResponseData extends ResponseData {
    data: {
        records: Records,
        total: number,
        size: number,
        current: number,
        searchCount: boolean,
        pages: number
    }
}

//品牌数据的ts类型
export interface Trademark {
    id: number,
    tmName: string,
    logoUrl: string
}

//品牌接口返回的数据的ts类型
export interface AllTrademark extends ResponseData {
    data: Trademark[]
}

//照片墙的ts类型
export interface SpuImg {
    id?: number,
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    imgName?: string,
    imgUrl?: string,
    name?: string,
    url?: string
}

//接口返回的已有的spu的照片墙的数据的ts类型
export interface SpuHasImg extends ResponseData {
    data: SpuImg[]
}

//已有的销售属性值的ts类型
export interface SaleAttrValue {
    id?: number,
    createTime?: string,
    updateTime?: string,
    supId?: number,
    baseSaleAttrId: number | string,
    saleAttrValueName: string,
    saleAttrName?: string,
    isChecked?: null
}

//存储已有的销售属性值数组类型
export type spuSaleAttrValueList = SaleAttrValue[]

//销售属性对象的ts类型
export interface SaleAttr {
    id?: number,
    createTime?: null,
    updateTime?: null,
    supId?: number,
    baseSaleAttrId: number | string,
    saleAttrName: string,
    spuSaleAttrValueList: spuSaleAttrValueList,
    flag?: boolean,
    saleAttrValue?: string,
    saleIdAndValueId?: string
}

//SPU已有的销售属性接口返回数据的ts类型
export interface SaleAttrResponseData extends ResponseData {
    data: SaleAttr[]
}

//整个项目的全部销售属性的ts类型
export interface HasSaleAttr {
    id: number,
    name: string
}

//整个项目的全部销售属性返回数据的ts类型
export interface HasSaleAttrResponseData extends ResponseData {
    data: HasSaleAttr[]
}

//SKU的平台属性值的ts类型
export interface SkuAttr {
    attrId: string | number,
    valueId: string | number
}

//SKU的销售属性值的ts类型
export interface SkuSaleAttr {
    saleAttrId: string | number,
    saleAttrValueId: string | number
}

//SKU数据的ts类型
export interface SkuData {
    category3Id: string |number,
    spuId: string | number,
    tmId: string | number,
    skuName: string,
    price: string | number,
    weight: string | number,
    skuDesc: string,
    skuAttrVallueList?: SkuAttr[],
    skuSaleAttrValueList?: SkuSaleAttr[],
    skuDefaultImg: string
}

//服务器返回SKU数据的ts类型
export interface SkuInfoData extends ResponseData {
    data: SkuData[]
}
